package com.corpgovernment.organization.mapper.budget;

import com.corpgovernment.organization.dto.AmountTotalDTO;
import com.corpgovernment.organization.dto.TimeIntervalDTO;
import com.corpgovernment.organization.entity.db.budget.BudgetInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Mapper
public interface BudgetInfoMapper {

    TimeIntervalDTO selectTimeInterval(@Param("corpId") String corpId);

    AmountTotalDTO selectAmounts(@Param("corpId") String corpId);

    BigDecimal selectAddAmounts(@Param("corpId") String corpId);

    List<BudgetInfoEntity> selectByCorpIdAndTime(@Param("corpId") String corpId, @Param("timeFrom") Date timeFrom, @Param("timeTo") Date timeTo);

    List<BudgetInfoEntity> selectByBudgetIds(@Param("budgetIds") List<String> budgetIds);

    BudgetInfoEntity existsByRangeType(@Param("corpId") String corpId, @Param("rangeType") String rangeType, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    BudgetInfoEntity selectByPrimaryKey(@Param("budgetId") String budgetId);

    int updateSelective(@Param("entity") BudgetInfoEntity budgetInfo);

    int insertSelective(@Param("entity") BudgetInfoEntity budgetInfo);

    List<BudgetInfoEntity> getCycleBudgetInfo(@Param("nowDayYMD") String nowDayYMD);

    void updateBudgetAmount(@Param("infoId") String infoId,@Param("amount") BigDecimal amount);
}